package com.thesis.client;

import com.thesis.utils.Defines;

import android.app.ActionBar;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class UserDetailActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_user_detail);
		
		ActionBar ab = getActionBar();
		ab.setTitle(getResources().getString(R.string.title_activity_user_detail));
		ab.setDisplayHomeAsUpEnabled(true);
		
		String[] detail = getIntent().getStringArrayExtra(Defines.USER_DETAIL);
		TextView tv_name = (TextView) findViewById(R.id.ud_tv_name);
		TextView tv_username = (TextView) findViewById(R.id.ud_tv_username);
		TextView tv_birthday = (TextView) findViewById(R.id.ud_tv_birthday);
		TextView tv_adress = (TextView) findViewById(R.id.ud_tv_adress);
		TextView tv_phone = (TextView) findViewById(R.id.ud_tv_phonenumber);
		TextView tv_role = (TextView) findViewById(R.id.ud_tv_role);
		TextView tv_manager = (TextView) findViewById(R.id.ud_tv_manager);
		
		tv_name.setText(detail[0]+" "+detail[1]);
		tv_name.setTypeface(Typeface.DEFAULT_BOLD);
		
		tv_username.setText(detail[2]);
		tv_username.setTypeface(Typeface.DEFAULT_BOLD);
		
		tv_birthday.setText(new StringBuilder(detail[3]).toString());
		tv_birthday.setTypeface(Typeface.DEFAULT_BOLD);
		
		tv_adress.setText(detail[4]);
		tv_adress.setTypeface(Typeface.DEFAULT_BOLD);
		
		tv_phone.setText(detail[5]);
		tv_phone.setTypeface(Typeface.DEFAULT_BOLD);
		
		if(detail[7].equals("0"))
			tv_role.setText(getResources().getString(R.string.role_waiter));
		else tv_role.setText(getResources().getString(R.string.role_manager));
		tv_role.setTypeface(Typeface.DEFAULT_BOLD);
		
		tv_manager.setText(detail[6]);
		tv_manager.setTypeface(Typeface.DEFAULT_BOLD);
		
		
//		btn_edit.setOnClickListener(new OnClickListener() {
//			
//			@Override
//			public void onClick(View v) {
//				// TODO Auto-generated method stub
//				startActivity(new Intent(UserDetailActivity.this,UserEditActivity.class));
//			}
//		});
//		btn_delete.setOnClickListener(new OnClickListener() {
//			
//			@Override
//			public void onClick(View v) {
//				new AlertDialog.Builder(UserDetailActivity.this)
//			    .setTitle("Xóa tài khoản")
//			    .setMessage("Bạn chắc chứ?")
//			    .setPositiveButton("Xóa", new DialogInterface.OnClickListener() {
//			        public void onClick(DialogInterface dialog, int which) { 
//			            // continue with delete
//			        	finish();
//			        }
//			     })
//			    .setNegativeButton("Hủy", new DialogInterface.OnClickListener() {
//			        public void onClick(DialogInterface dialog, int which) { 
//			            // do nothing
//			        }
//			     })
//			     .show();
//				
//			}
//		});
//		
		
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case android.R.id.home:
			finish();
			return true;
		default:
			return super.onOptionsItemSelected(item);
		}
	}
	

}
